/**
 * @projectName 高校就业网
 * @package com.kzj.CollegeEmploymentNetwork.controller
 * @className com.kzj.CollegeEmploymentNetwork.controller.JobCollectController
 * @copyright Copyright 2025 Thunisoft, Inc. All rights reserved.
 */
package com.kzj.CollegeEmploymentNetwork.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.thunisoft.artery.data.annotation.DataTranslate;
import com.kzj.CollegeEmploymentNetwork.model.JobCollect;
import com.kzj.CollegeEmploymentNetwork.service.JobCollectService;
import com.kzj.CollegeEmploymentNetwork.validate.Validate;
import com.thunisoft.dilu.component.page.aop.QueryPage;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

/**
 * JobCollectController
 * 
 * @description 职位收藏表
 * @author kzj
 * @date 2025年01月20日 23:11:54
 * @version 1.0.0
 */
@Api(value = "职位收藏表", tags = "职位收藏表")
@RequestMapping(value = "/api/v1")
@RestController
public class JobCollectController {

    /**
     * jobcollectService
     */
    @Autowired
    private JobCollectService jobcollectService;

    /**
     * 
     * JobCollectController
     * 
     * @description 创建职位收藏表
     * @param jobcollect 职位收藏表
     * @return 影响行数
     * @author kzj
     * @date 2025年01月20日 23:11:54
     * @version 1.0.0
     */
    @ApiOperation(value = "创建职位收藏表", response = Integer.class)
    @PostMapping(value = "/jobcollect", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Integer> insert(@Validated({Validate.class}) @RequestBody JobCollect jobcollect) {
        Integer count = jobcollectService.insert(jobcollect);
        return new ResponseEntity<>(count, HttpStatus.OK);
    }

    /**
     * 
     * JobCollectController
     * 
     * @description 删除职位收藏表
     * @param id 主键
     * @return 影响行数
     * @author kzj
     * @date 2025年01月20日 23:11:54
     * @version 1.0.0
     */
    @ApiOperation(value = "删除职位收藏表", response = Integer.class)
    @DeleteMapping(value = "/jobcollect/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Integer> delete(@ApiParam(name = "id", required = true) @PathVariable("id") String id) {
        Integer count = jobcollectService.delete(id);
        return new ResponseEntity<>(count, HttpStatus.OK);
    }

    /**
     * 
     * JobCollectController
     * 
     * @description 修改职位收藏表
     * @param jobcollect 职位收藏表
     * @return 影响行数
     * @author kzj
     * @date 2025年01月20日 23:11:54
     * @version 1.0.0
     */
    @ApiOperation(value = "修改职位收藏表", response = Integer.class)
    @PutMapping(value = "/jobcollect", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Integer> update(@Validated({Validate.class}) @RequestBody JobCollect jobcollect) {
        Integer count = jobcollectService.update(jobcollect);
        return new ResponseEntity<>(count, HttpStatus.OK);
    }

    /**
     * 
     * JobCollectController
     * 
     * @description 分页查询职位收藏表
     * @param jobcollect 查询条件
     * @return PageInfo<JobCollect>
     * @author kzj
     * @date 2025年01月20日 23:11:54
     * @version 1.0.0
     */
    @ApiOperation(value = "分页查询职位收藏表", response = JobCollect.class)
    @GetMapping(value = "/jobcollect/page", produces = MediaType.APPLICATION_JSON_VALUE)
    @DataTranslate
    @QueryPage
    public ResponseEntity<List<JobCollect>> selectAll(JobCollect jobcollect) {
        List<JobCollect> pageData = jobcollectService.select(jobcollect);
        return new ResponseEntity<>(pageData, HttpStatus.OK);
    }

    /**
     * 
     * JobCollectController
     * 
     * @description 查询职位收藏表
     * @param id 主键
     * @return JobCollect
     * @author kzj
     * @date 2025年01月20日 23:11:54
     * @version 1.0.0
     */
    @ApiOperation(value = "查询职位收藏表", response = JobCollect.class)
    @GetMapping(value = "/jobcollect/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
    @DataTranslate
    public ResponseEntity<JobCollect> selectOne(@ApiParam(name = "id", required = true) @PathVariable("id") String id) {
        JobCollect result = jobcollectService.selectOne(id);
        return new ResponseEntity<>(result, HttpStatus.OK);
    }
}